<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 浅拷贝：拷贝地址  ----  地址共享，相互影响    arr2 = arr1        实参传递值给形参的时候   也是浅拷贝
        // 深拷贝：拷贝的是值  --- 地址是独立的




        var arr1 = [1, 2, 3];   // 608


        // 浅拷贝：拷贝的是地址
        // var arr2 = arr1;


        // 深拷贝：拷贝值
        var arr2 = [];   // 609
        for (var i = 0; i < arr1.length; i++) {
            arr2.push(arr1[i]);
        }


        arr1.push(4);

        console.log(arr2);





    </script>

</body>

</html>